import type { InspectionPlanModel, ManualInspectInput } from './models';

import { requestClient } from '#/api/request';

/**
 * 查询所有的手动点检计划，其中包含设备具体信息
 * @param params 查询参数
 * @returns 返回查询结果
 */
export async function getAllManualInspectionPlanListApi(params?: any) {
  return requestClient.get<InspectionPlanModel[]>(
    '/mes/equipment/inspect/manual/plan/list',
    {
      params,
    },
  );
}

/**
 * 获取指定设备的手动点检计划，包含点检项目清单
 * @param machineryId 设备 Id
 * @returns 返回查询结果
 */
export async function getManualInspectionPlanApi(machineryId: number) {
  return requestClient.get<InspectionPlanModel>(
    '/mes/equipment/inspect/manual/plan',
    {
      params: { machineryId },
    },
  );
}

/**
 * 手动点检
 * @param data 点检数据
 * @returns 返回结果
 */
export async function manualInspectApi(data: ManualInspectInput) {
  return requestClient.post<boolean>('/mes/equipment/inspect/manual', data);
}
